package com.gr100.biz.app.mvc;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * Created by YFsoft on 16/3/16.
 */
@Controller
public class SyncController {

    private static final Logger logger = LogManager.getLogger(SyncController.class);

    @ResponseBody
    @RequestMapping(value= "v1.0/sync/syncFunction",method= RequestMethod.POST)
    public String syncFunction(@RequestParam Map map){
        String method = map.get("method").toString();
        String paramStr = map.get("paramStr").toString();
        String s = SyncService.syncFunction(method, paramStr);
        logger.debug(s);
        return s;
    }

    @ResponseBody
    @RequestMapping(value= "v1.0/hi",method= RequestMethod.GET)
    public String sayHi(){
        return "A 2 This is a test message from ap11i@" + System.currentTimeMillis();
    }


}
